-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI | Add threshold user input validation (AST-40169) #715
Conversation
Policy Management Violations
No New Or Fixed Issues Found |
internal/commands/scan.go
Outdated
func parseThresholdLimit(limit string) (engineName string, intLimit int, err error) { | ||
parts := strings.Split(limit, "=") | ||
engineName = strings.Replace(parts[0], commonParams.KicsType, commonParams.IacType, 1) | ||
if len(parts) > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reduce Cyclomatic Complexity if you invert the condition:
if len(parts) <= 1
{
return engineName, intLimit, err
}
and later the logic you currently have inside len(parts) > 1
internal/commands/scan.go
Outdated
} | ||
|
||
func normalizeThresholds(threshold string) string { | ||
return strings.ReplaceAll(strings.ReplaceAll(threshold, " ", ""), ",", ";") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
any chance to make it more readable?
By submitting a PR to this repository, you agree to the terms within the Checkmarx Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Add threshold user input validation
References
https://checkmarx.atlassian.net/browse/AST-40169
Testing
Checklist